using System;

namespace octalforty.Syndication.Core.Rss
{
    /// <summary>
    /// Represents a single RSS channel, which contains information about the channel 
    /// (metadata) and its contents.
    /// </summary>
    public sealed class RssChannel : RssEntityBase
    {
        #region Private Member Variables
        private String language = String.Empty;
        private String copyright = String.Empty;
        private IPerson managingEditor;
        private IPerson webMaster;
        private DateTime? updatedOn = DateTime.Now;
        private String generator = String.Empty;
        private TimeSpan? timeToLive;
        private RssItemCollection items = new RssItemCollection();
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets or sets a <see cref="String"/> which defines the language the channel 
        /// is written in.
        /// </summary>
        public String Language
        {
            get { return language; }
            set { language = value; }
        }

        /// <summary>
        /// Gets or sets a <see cref="String"/> which contains the copyright notice 
        /// for content in the channel.
        /// </summary>
        public String Copyright
        {
            get { return copyright; }
            set { copyright = value; }
        }

        /// <summary>
        /// Gets or sets a reference to the <see cref="IPerson"/> which represents a person
        /// responsible for editorial content.
        /// </summary>
        public IPerson ManagingEditor
        {
            get { return managingEditor; }
            set { managingEditor = value; }
        }

        /// <summary>
        /// Gets or sets a reference to the <see cref="IPerson"/> which represents a person
        /// responsible for technical issues relating to channel.
        /// </summary>
        public IPerson WebMaster
        {
            get { return webMaster; }
            set { webMaster = value; }
        }

        /// <summary>
        /// Gets or sets a <see cref="DateTime"/> which contains the last time the 
        /// content of the channel changed.
        /// </summary>
        public DateTime? UpdatedOn
        {
            get { return updatedOn; }
            set { updatedOn = value; }
        }

        /// <summary>
        /// Gets or sets a <see cref="String"/> which indicates the program used to 
        /// generate the channel.
        /// </summary>
        public String Generator
        {
            get { return generator; }
            set { generator = value; }
        }

        /// <summary>
        /// Gets or sets a <see cref="TimeSpan"/> which contains the time that indicates how long a channel 
        /// can be cached before refreshing from the source.
        /// </summary>
        public TimeSpan? TimeToLive
        {
            get { return timeToLive; }
            set { timeToLive = value; }
        }

        /// <summary>
        /// Gets a reference to the <see cref="RssItemCollection"/> which contains
        /// <see cref="RssItem"/> for this channel.
        /// </summary>
        public RssItemCollection Items
        {
            get { return items; }
        }
        #endregion

        /// <summary>
        /// Initializes a new instance of <see cref="RssChannel"/> class.
        /// </summary>
        public RssChannel()
        {
        }

        /// <summary>
        /// Initializes a new instance of <see cref="RssChannel"/> class
        /// with a given title, link and description.
        /// </summary>
        /// <param name="title"></param>
        /// <param name="link"></param>
        /// <param name="description"></param>
        public RssChannel(string title, string link, string description) : 
            base(title, link, description)
        {
        }
    }
}
